home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bitstrg.zip / LDECARBI.C < prev    next >
C/C++ Source or Header  |  1989-06-05  |  861b  |  43 lines

  1. /*
  2.     librairie : bitstrg
  3.  
  4.     ldecarbit -- declaration d'un champ memoire comme etant un champ de bits
  5.  
  6.                     Le parametre nombre de bits est de type unsigned long
  7.  
  8.     Attention : en Small Memory Model le champ Data est limite a 64Koctets
  9. */
  10.  
  11. /*
  12. #define debug
  13. */
  14.  
  15. /* standard include */
  16.  
  17. #include <stdio.h>
  18.  
  19. #include "bitstrg.h"
  20.  
  21. /*
  22.      declaration of a memory field as an array of bit
  23.  
  24.     return a pointer on the array parameters structure or NULL if problem
  25. */
  26.  
  27. struct LSPARRAY* ldecarbit(ptr,nombr)
  28.     ELEBAR*        ptr;        /* pointer on the memory field */
  29.     unsigned    nombr;        /* number of elements in the field */
  30. {
  31.  
  32.     struct LSPARRAY* pnt;
  33.  
  34.     if(nombr == 0) {
  35.         return(NULL);
  36.     }
  37.     if((pnt = (struct LSPARRAY *) calloc (1,sizeof(struct LSPARRAY))) != NULL) {
  38.         pnt->pntarray = ptr;
  39.         pnt->numlbit = (nombr * SIZE) - 1;
  40.     }
  41.     return(pnt);
  42. }
  43.